//
//  XDPlaceScenicDetailsCollectionViewCell.m
//  Le way walkers
//
//  Created by YaZhiLiang on 15/5/23.
//  Copyright (c) 2015年 LTXZ. All rights reserved.
//

#import "XDPlaceScenicDetailsCollectionViewCell.h"

@implementation XDPlaceScenicDetailsCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        
        self.MyImage = [[UIImageView alloc]init];
        
        [self.contentView addSubview:self.MyImage];
        
        self.name = [[UILabel alloc] init];
        
        [self.MyImage addSubview:self.name];
        
        [_name release];
        
        [_MyImage release];
        
    }
    return self;
}


-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    self.MyImage.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.bounds.size.height);
    
    self.MyImage.layer.cornerRadius = 8;
    
    self.MyImage.layer.masksToBounds = YES;
    
    self.MyImage.userInteractionEnabled = YES;
    
    self.name.frame = CGRectMake(10, 100, 120, 40);
    
    self.name.font = [UIFont systemFontOfSize:17.0];
    
    //    self.name.backgroundColor = [UIColor blackColor];
    
    self.name.textColor = [UIColor whiteColor];
    
    self.name.userInteractionEnabled = YES;
    
}

- (void)setXdSenic:(XDPlaceSenic *)xdSenic
{
    if (_xdSenic != xdSenic) {
        
        [_xdSenic release];
        
        _xdSenic = [xdSenic retain];
    }
    
    [self.MyImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@", xdSenic.cover_s]] placeholderImage:[UIImage imageNamed:@"69E58PIChJC_1024.jpg"]];
    
    self.name.text = xdSenic.name;
    
    self.ScenicID = xdSenic.ScenicID;
    
    self.typeName = xdSenic.type;
    
}

@end
